package com.shen;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Author:shen
 * CreateDate:2020/6/3.
 * Function:
 */
public class demo07 {
    public static void main(String[] args) {
        FileWriter fileWriter=null;
        BufferedWriter bufferedWriter=null;
        try {
            fileWriter=new FileWriter("E:/a/data.txt");
            bufferedWriter=new BufferedWriter(fileWriter);
            byte[] ary=new byte[1024];
            int count=0;
            for (int i=1;i<=10000;i++){
                if (isPrime(i)){
                    count++;
                        bufferedWriter.write(i+"");
                        bufferedWriter.write("\t");
                    if(count==10){
                       bufferedWriter.newLine();
                       count=0;
                    }

                }
            }
            bufferedWriter.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if(fileWriter!=null){
                    fileWriter.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
    public static  boolean isPrime(double num){
        boolean isflag=true;
        for (int i=2;i<num;i++){
            if(num%i==0){
                isflag=false;
            }
        }
        return  isflag;
    }
}
